<template>
  <div>
    <div>
      <!-- 内容 -->
      <div class="conter">
        <div class="conters">
          <el-card class="xinxibox">
            <div class="clearfix">
              <div class="imgbox">
                <el-avatar :size="60" :src="details.avatar" @error="errorHandler">
                  <!-- <img :src="details.projectFile" /> -->
                </el-avatar>
              </div>
              <h5 class="enterprise">{{ details.bodyName }}</h5>
              <span class="enterprise" style="color: #1388bd">{{details.code}}</span>
              <span class="enterprise enyichu" style="
                  text-indent: 2em;
                  display: block;
                  margin-top: 5px;
                ">{{ details.dataDescription }}</span>
              <div class="but">
                <span v-if="showPhone" style="margin-top:80px;">{{details.phone}}</span>
                <el-button v-else type="primary" round style="margin-top:80px;" @click="getPhone">获取联系方式</el-button>
              </div>
            </div>
          </el-card>
          <el-card class="xianshi">
            <div slot="header" class="clearfix">
              <div class="clear">
                <h3>{{ details.projectName }}</h3>
                <img src="@/assets/image/icon-time.png" alt="" width="20px" /><span>{{ details.createTime |
                  formDate}}</span>
                <img src="@/assets/image/icon-view.png" alt="" class="img" width="20px" /><span>{{ details.visitCount
                  }}次</span>
              </div>
            </div>
            <div class="box">
              <div class="counterbox">
                <div class="counterheard">
                  <h5>摘要</h5>
                </div>
                <div class="counter">
                  <span>{{ details.projectDescribe }}</span>
                  <div class="counterimg">
                    <Editor :value="details.projectFile"></Editor>
                  </div>
                </div>
              </div>
            </div>
          </el-card>
        </div>
      </div>
      <!-- 底部 -->
      <Footer></Footer>
    </div>
  </div>
</template>

<script>
import { ProgictById } from '../api/api'
export default {
  name: 'PersonalCenter',
  components: {},
  data() {
    return {
      errorHandler: true,
      projectId: 1,
      details: {},
      showPhone: false
    }
  },
  props: {},
  computed: {},
  methods: {
    getProjectDetails() {
      ProgictById(this.projectId).then(res => {
        this.details = res.data.data
      })
    },
    getPhone() {
      this.showPhone = true
    }
  },
  filters: {
    formDate(val) {
      const dt = new Date(val)
      const y = dt.getFullYear()
      const m = (dt.getMonth() + 1 + '').padStart(2, '0')
      const d = (dt.getDate() + '').padStart(2, '0')
      return `${y}-${m}-${d}`
    }
  },
  created() {},
  mounted() {
    this.projectId = this.$route.query.id
    this.getProjectDetails()
  }
}
</script>

<style scoped lang="less">
/* 外部盒子 */
.conters {
  width: 80%;
  min-height: 800px;
  display: flex;
  justify-content: center;
  /*垂直居中*/
  align-items: stretch;
  /*水平居中*/
}

// 头像
.imgbox {
  width: 100%;

  img {
    width: 100%;
  }
}

.bottom {
  margin-top: 50px;
  // height: 186px;
  background-color: #122c7a;
  display: flex;
  justify-content: center;
  /*垂直居中*/
  align-items: center;

  /*水平居中*/
  .conterbox {
    width: 40%;
    display: flex;
    justify-content: center;
    /*垂直居中*/
    align-items: center;

    /*水平居中*/
    .box {
      width: 56%;
      color: #ffffff;
      font-size: 10px;

      img {
        width: 10%;
        height: 100%;
      }
    }

    .QRcode {
      color: #ffffff;
      width: 40%;
      border-left: 1px solid #ebeef5;
      display: flex;
      justify-content: center;
      /*垂直居中*/
      align-items: center;

      /*水平居中*/
      .qr {
        .icon {
          display: flex;
          justify-content: center;
          align-items: center;
          font-size: 12px;
        }
      }
    }
  }
}

.xianshi {
  // background-color: rgb(138, 167, 167);
  // float: right;
  width: 80%;
  // height: 600px;
  // box-shadow: 5px 5px 10px #5e5e5e, -5px -5px 10px #ffffff;
  margin-left: 20px;
  margin-top: 2%;

  .box {
    width: 100%;
    display: flex;
    justify-content: center;
    /*垂直居中*/
    align-items: center;

    /*水平居中*/
    .counterbox {
      width: 80%;

      // background-color: #f50000;
      .counterheard {
        border-bottom: 1px solid #ebeef5;
      }

      .counter {
        margin-top: 10px;

        span {
          text-indent: 2em;
          display: block;
          // height: 148px;
          margin-bottom: 35px;
        }

        // .counterimg {
        // display: flex;
        // justify-content: center;
        /*垂直居中*/
        // align-items: center;

        // /*水平居中*/
        // img {
        //   display: flex;
        //   justify-content: center;
        //   /*垂直居中*/
        //   align-items: center;
        //   /*水平居中*/
        //   width: 80%;
        // }
        // }
      }
    }
  }

  .clearfix {
    display: flex;
    justify-content: center;
    /*垂直居中*/
    align-items: center;

    /*水平居中*/
    .clear {
      width: 98%;
      margin-left: 25px;

      .img {
        margin-left: 10px;
      }

      span {
        font-size: 10px;
      }
    }
  }
}

.xinxibox {
  // background-color: aqua;
  width: 25%;
  // height: 600px;
  // box-shadow: 5px 5px 10px #5e5e5e, -5px -5px 10px #ffffff;
  margin-top: 2%;

  .tongx {
    border-radius: 50%;
    background-color: #ff0000;
    height: 80px;
    width: 80px;
  }

  .text {
    font-size: 14px;
    color: #000;
    margin-left: 50px;
  }

  .item {
    margin-bottom: 18px;
  }

  .clearfix {
    .imgbox {
      display: flex;
      justify-content: center;
      /*垂直居中*/
      align-items: center;
      /*水平居中*/
    }

    // .enyichu {
    //   text-overflow: ellipsis;
    //   white-space: nowrap; /*超出部分省略号表示*/
    //   overflow: hidden; /*超出部分隐藏*/
    // }
    .enterprise {
      display: flex;
      justify-content: center; //水平
      align-items: center; //垂直
    }

    .but {
      display: flex;
      justify-content: center;
      /*垂直居中*/
      align-items: center;
      /*水平居中*/
    }
  }

  .clearfix1 {
    border-bottom: 1px solid #ebeef5;
  }

  // .clearfix:before,
  // .clearfix:after {
  //   display: table;
  //   content: "";
  // }
  // .clearfix:after {
  //   clear: both;
  // }
}
</style>